package cn.zhqr.lib.bean;

/**
 * Created by charles on 2018/12/6.
 */
public class KeyValue {
    public Object key;
    public String value;

    public static KeyValue kv(Object key,String value){
        return new KeyValue(key, value);
    }
    protected KeyValue(Object key, String value){
        this.key = key;
        this.value = value;
    }

    @Override
    public boolean equals(Object obj) {
        if(obj instanceof KeyValue){
            return ((KeyValue)obj).key.equals(this.key);
        }
        return obj.equals(this.key);
    }

    @Override
    public String toString() {
        return this.value;
    }

    public <T> T getKey() {
        return (T)key;
    }

    public void setKey(Object key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
